import request from '@/utils/request';

// 推送对象-新增用户
export function addPushObjectUser(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeUser/save',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-用户列表(密送收件人抄送列表)
export function getPushObjectUserList(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeUser',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-修改用户列表
export function updatePushObjectUser(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeUser',
		method: 'put',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-删除用户
export function deletePushObjectUser(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeUser/delete/' + id,
		method: 'delete',
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-导入用户
export function importPushObjectUser(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeUser',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}


// 推送对象-下载用户模板
export function pushObjectUserDownTemplate(): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeUser/downloadTemplate',
		method: 'get',
		headers: {
			VERSION: 'dengfazhu',
		},
        responseType: 'blob',
	});
}

// 推送对象-新增应用
export function addPushObjectApp(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeApp/save',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-应用列表
export function getPushObjectAppList(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeApp',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-修改应用列表
export function updatePushObjectApp(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeApp',
		method: 'put',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-删除应用
export function deletePushObjectApp(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeApp/delete/' + id,
		method: 'delete',
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-下载应用模板
export function pushObjectAppDownTemplate(): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeApp/downloadTemplate',
		method: 'get',
		headers: {
			VERSION: 'dengfazhu',
		},
        responseType: 'blob',
	});
}

// 推送对象-导入应用
export function importPushObjectApp(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/addresseeUser',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

/*-----------------发送邮箱设置------------------*/ 

// 推送对象-新增发件人邮箱地址
export function addPushObjectEmailAdress(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/confAddresser/save',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-发件人邮箱地址列表
export function getPushObjectEmailAdressList(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/confAddresser',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-修改发件人邮箱地址
export function updatePushObjectEmailAdress(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/confAddresser',
		method: 'put',
		data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-删除发件人邮箱地址
export function deletePushObjectEmailAdress(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/confAddresser/delete/' + id,
		method: 'delete',
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-保存系统默认发件人
export function savePushObjectDefaultEmailAdress(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/confAddresser/defaultSender/' + id,
		method: 'get',
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

// 推送对象-发送测试邮件
export function pushObjectSendTestEmail(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/email/send',
		method: 'post',
        data: data,
		headers: {
			VERSION: 'dengfazhu',
		},
	});
}

/*-----------------运行失败提醒------------------*/ 

// 推送对象-查询运行失败提醒是否开启
export function getPlatformReminderState(): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/reportTaskInfo/getPlatformReminderState',
		method: 'get',
		headers: {
			VERSION: 'LSH',
		},
	});
}

// 推送对象-修改运行失败提醒开启状态
export function updatePlatformReminderState(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/reportTaskInfo/platformReminderHandle/' + id,
		method: 'put',
		headers: {
			VERSION: 'LSH',
		},
	});
}